<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hero", $con);
$dateTime = date("Y-m-d",strtotime("-1 day"));
#$dateTime = '2012-03-28';

mysql_query("INSERT INTO hero_query_temp
SELECT max( id ),cents099,
  Cents1999,
  Cents499,
  Cents4999,
  Cents9999,
  IAPMoney,
  allGameTime,
  allGetMoney ,
  ruleInfos_107,
  battleGroundLevelInfos_3,
  equipInfos_level,
  equipInfos,
  roleClassInfos_battleTimes,
  roleClassInfos_count,
  roleClassInfos_roleClass,
  heroData_0_currentEquips,
  heroData_0_level,
  heroData_0_todayGetExp,
  heroData_0,
  heroData_1_currentEquips,
  heroData_1_level,
  heroData_1_todayGetExp,
  heroData_1,
  heroData_2_currentEquips,
  heroData_2_level,
  heroData_2_todayGetExp,
  heroData_2,
  heroData_3_currentEquips,
  heroData_3_level,
  heroData_3_todayGetExp,
  heroData_3,
  heroData_4_currentEquips,
  heroData_4_level,
  heroData_4_todayGetExp,
  heroData_4,
  heroData_5_currentEquips,
  heroData_5_level,
  heroData_5_todayGetExp,
  heroData_5,
  heroData_6_currentEquips,
  heroData_6_level,
  heroData_6_todayGetExp,
  heroData_6 ,
  heroData_7_currentEquips,
  heroData_7_level,
  heroData_7_todayGetExp,
  heroData_7,
  heroData_8_currentEquips,
  heroData_8_level,
  heroData_8_todayGetExp,
  heroData_8,
  heroData_9_currentEquips,
  heroData_9_level,
  heroData_9_todayGetExp,
  heroData_9,
  heroData_10_currentEquips,
  heroData_10_level,
  heroData_10_todayGetExp,
  heroData_10,
  heroData_11_currentEquips,
  heroData_11_level,
  heroData_11_todayGetExp,
  heroData_11,
  heroData_12_currentEquips,
  heroData_12_level,
  heroData_12_todayGetExp,
  heroData_12,
  heroData_13_currentEquips,
  heroData_13_level,
  heroData_13_todayGetExp,
  heroData_13,
  heroData_14_currentEquips,
  heroData_14_level,
  heroData_14_todayGetExp,
  heroData_14,
  heroData_15_currentEquips,
  heroData_15_level,
  heroData_15_todayGetExp,
  heroData_15,
  heroData_16_currentEquips,
  heroData_16_level,
  heroData_16_todayGetExp,
  heroData_16,
  heroData_17_currentEquips,
  heroData_17_level,
  heroData_17_todayGetExp,
  heroData_17 ,
  heroData_18_currentEquips,
  heroData_18_level,
  heroData_18_todayGetExp,
  heroData_18,
  heroData_19_currentEquips,
  heroData_19_level,
  heroData_19_todayGetExp,
  heroData_19,
  heroData_20_currentEquips,
  heroData_20_level,
  heroData_20_todayGetExp,
  heroData_20,
  heroData_21_currentEquips,
  heroData_21_level ,
  heroData_21_todayGetExp,
  heroData_21,
  heroData_22_currentEquips,
  heroData_22_level,
  heroData_22_todayGetExp,
  heroData_22,
  heroData_23_currentEquips,
  heroData_23_level,
  heroData_23_todayGetExp,
  heroData_23,
  heroData_24_currentEquips,
  heroData_24_level,
  heroData_24_todayGetExp,
  heroData_24,
  heroData_25_currentEquips,
  heroData_25_level,
  heroData_25_todayGetExp,
  heroData_25,
  heroData_26_currentEquips,
  heroData_26_level ,
  heroData_26_todayGetExp,
  heroData_26,
  heroData_27_currentEquips,
  heroData_27_level,
  heroData_27_todayGetExp,
  heroData_27,
  heroData_28_currentEquips,
  heroData_28_level,
  heroData_28_todayGetExp,
  heroData_28,
  heroData_29_currentEquips,
  heroData_29_level,
  heroData_29_todayGetExp,
  heroData_29,
  heroData_30_currentEquips,
  heroData_30_level,
  heroData_30_todayGetExp,
  heroData_30,
  heroData_31_currentEquips,
  heroData_31_level,
  heroData_31_todayGetExp,
  heroData_31,
  heroData_32_currentEquips,
  heroData_32_level,
  heroData_32_todayGetExp,
  heroData_32,
  roleClassData_Barbarian_roleClass,
  roleClassData_Barbarian_count,
  roleClassData_Barbarian_battleTimes,
  roleClassData_Fighter_roleClass,
  roleClassData_Fighter_count,
  roleClassData_Fighter_battleTimes,
  roleClassData_Paladin_roleClass,
  roleClassData_Paladin_count,
  roleClassData_Paladin_battleTimes,
  battleInfos_retreatTimes,
  battleInfos_faildTimes,
  battleInfos_winTimes,
  battleInfos_totalTimes,
  battleInfos_level,
  battleInfos,
  wavesEachTime,
  survivalBattleTimes,
  hireHeroCost,
  hireHeroTimes,
  upgradeCost,
  upgradeTimes,
  shopRefreshCost,
  shopRefreshTimes,
  buyEquipCost,
  buyEquipTimes,
  resetSkillCost,
  resetSkillTimes,
  todaySaleEquips,
  todayBuyEquips,
  teamMemberClass,
  launchFromNotification,
  exitWhichBattleGround,
  exitWhichScreen,
  todayOpenTimes,
  openTimes,
  arenaTotalOpenTimes,
  arenaTodayOpenTimes,
  arenaTotalGameTime,
  arenaTodayGameTime,
  arenaTodayLobbyChallengeTimes,
  arenaTodayLobbyChallengeWinTimes,
  arenaTodayReportChallengeTimes,
  arenaTodayReportChallengeWinTimes,
  arenaTodayScoutTimes,
  arenaTotalGetBadges,
  arenaTodayGetBadges,
  todayGameTime,
  registerDate,
  versionNum,
  deviceid,
  gamename,
  createdate,
  date
FROM hero_query
WHERE date = '$dateTime'
GROUP BY deviceid");
#mysql_query("INSERT INTO dinocap2hd SELECT NULL,dayGetMoney, dayIap1BuyTimes,dayIap2BuyTimes,dayIap3BuyTimes,dayIap4BuyTimes,dayIap5BuyTimes,dayIap6BuyTimes,dayIapMoney,dayPlayTime,dayTotalTime,dayUI1TapCount,dayUI2TapCount,dayUI3TapCount,dayUI4TapCount,dayUI5TapCount,dayUI6TapCount,dayUI7TapCount,dayUI8TapCount,dayUI9TapCount,dayUsedMoney,firstlogindata,firstlogin,fromNotificationCount,isjailbreak,lastMission,lastMissionState,lastMissionType,lastTapUI,mission1End,mission1Exit,mission1Retry,mission1Select,mission2End,mission2Exit,mission2Retry,mission2Select,mission3End,mission3Exit,mission3Retry,mission3Select,mission4End,mission4Exit,mission4Retry,mission4Select,mission5End,mission5Exit,mission5Retry,mission5Select,mission6End,mission6Exit,mission6Retry,mission6Select,mission7End,mission7Exit,mission7Retry,mission7Select,mission8End,mission8Exit,mission8Retry,mission8Select,nowMoney,player1DayExp,player1Level,player1TotalExp,player1Weapon1Level,weapon1IsUpdate,player1Weapon2Level,weapon2IsUpdate,player1Weapon3Level,weapon3IsUpdate,player1Weapon4Level,weapon4IsUpdate,player1Weapon5Level,weapon5IsUpdate,player1Weapon6Level,weapon6IsUpdate,player1WeaponBulletCount,player1WeaponBulletMoney,player1WeaponUpdateCount,player1WeaponUpdateMoney,player2DayExp,player2Level,player2TotalExp,player2Weapon1Level,weapon1IsUpdate_2,player2Weapon2Level,weapon2IsUpdate_2,player2Weapon3Level,weapon3IsUpdate_2,player2Weapon4Level,weapon4IsUpdate_2,player2Weapon5Level,weapon5IsUpdate_2,player2Weapon6Level,weapon6IsUpdate_2,player2WeaponBulletCount,player2WeaponBulletMoney,player2WeaponUpdateCount, player2WeaponUpdateMoney , player3DayExp, player3Level, player3TotalExp, player3Weapon1Level,weapon1IsUpdate_3,player3Weapon2Level,weapon2IsUpdate_3,player3Weapon3Level,weapon3IsUpdate_3,player3Weapon4Level,weapon4IsUpdate_3,player3Weapon5Level,weapon5IsUpdate_3,player3Weapon6Level,weapon6IsUpdate_3,player3WeaponBulletCount,player3WeaponBulletMoney,player3WeaponUpdateCount,player3WeaponUpdateMoney,player4DayExp,player4Level,player4TotalExp,player4Weapon1Level,weapon1IsUpdate_4,player4Weapon2Level,weapon2IsUpdate_4,player4Weapon3Level,weapon3IsUpdate_4,player4Weapon4Level,weapon4IsUpdate_4,player4Weapon5Level,weapon5IsUpdate_4,player4Weapon6Level,weapon6IsUpdate_4,player4WeaponBulletCount,player4WeaponBulletMoney,player4WeaponUpdateCount,player4WeaponUpdateMoney,player5DayExp,player5Level,player5TotalExp,player5Weapon1Level,weapon1IsUpdate_5,player5Weapon2Level,weapon2IsUpdate_5,player5Weapon3Level,weapon3IsUpdate_5,player5Weapon4Level,weapon4IsUpdate_5,player5Weapon5Level,weapon5IsUpdate_5,player5Weapon6Level,weapon6IsUpdate_5,player5WeaponBulletCount,player5WeaponBulletMoney,player5WeaponUpdateCount,player5WeaponUpdateMoney,totalMoney,totalTime,deviceid,gamename,whatday,createdate,date  FROM  dinocap2hd_query_temp");
#mysql_query("rename table dinocap2hd_query_temp to dinocap2hd");
mysql_close($con);
?>